<!--{block return}-->

<style type="text/css">
	<!--{if $_G['gp_action'] == 'edit'}-->
	#auc_op input,#auc_type_ctrl,#auc_virtual_ctrl{background-color:#efefef;}
	<!--{/if}-->
	.specialpost b{color:#F26C4F;}
</style>

<div class="exfm cl" id="auc_op">
	<!--left-->
	<input type="hidden" name="attachnew" value="1" />
	<div class="sinf sppoll z">
		<dl>
			<!--name-->
			<dt><span class="rq">*</span><label for="shangjia_name">商家名称:</label></dt>
			<dd>
			<span class="ftid"><input name="shangjia_name" id="shangjia_name" tabindex="2" type="text" class="px oinf" {if $auction['name']}value="{$auction['name']}"{/if} onkeyup="showtypeoption();" {if $_G['gp_action'] == 'edit'}disabled="disabled"{/if}/></span>
			</dd>
			<!--time-->
			<dt><span class="rq">*</span><label for="shangjia_zhekou">折扣:</label></dt>
			<dd>
				<span class="ftid"><input name="shangjia_zhekou" id="shangjia_zhekou" tabindex="2" type="text" class="px oinf" {if $auction['name']}value="{$auction['name']}"{/if} onkeyup="showtypeoption();" {if $_G['gp_action'] == 'edit'}disabled="disabled"{/if}/></span>
			</dd>
			<!--market price-->
			<dt><span class="rq">*</span><label for="shangjia_renjun">人均消费:</label></dt>
			<dd>
				<span class="ftid"><input name="shangjia_renjun" id="shangjia_renjun" tabindex="2" type="text" class="px oinf" {if $auction['name']}value="{$auction['name']}"{/if} onkeyup="showtypeoption();" {if $_G['gp_action'] == 'edit'}disabled="disabled"{/if}/></span>
			</dd>
			<!--is virtual or not-->
			<dt><span class="rq">*</span><label for="shangjia_time">营业时间:</label></dt>
			<dd>
				<span class="ftid">
					<input type="text" name="shangjia_time" id="shangjia_time" tabindex="2" class="px">
				</span>
			</dd>
			<!--auction type-->
			<dt><span class="rq">*</span><label for="shangjia_dizhi">商家地址:</label></dt>
			<dd>
				<span class="ftid"><input name="shangjia_dizhi" id="shangjia_dizhi" tabindex="2" type="text" class="px oinf" {if $auction['name']}value="{$auction['name']}"{/if} onkeyup="showtypeoption();" {if $_G['gp_action'] == 'edit'}disabled="disabled"{/if}/></span>
			</dd>
			<dt><span class="rq">*</span><label for="shangjia_dianhua">电话:</label></dt>
			<dd>
				<span class="ftid"><input name="shangjia_dianhua" id="shangjia_dianhua" tabindex="2" type="text" class="px oinf" {if $auction['name']}value="{$auction['name']}"{/if} onkeyup="showtypeoption();" {if $_G['gp_action'] == 'edit'}disabled="disabled"{/if}/></span>
			</dd>
		</dl>
	</div>
</div>
<script type="text/javascript" reload="1">
	simulateSelect('auc_type');
	simulateSelect('auc_virtual');
</script>
<script type="text/javascript" reload="1">
function getid_auc(id) {
	return document.getElementById(id);
}

function showtypeoption() {
	var v = 0;t = 1;
	v = getid_auc('auc_virtual').value;
	t = getid_auc('auc_type').value;
	if(v == 0 && t == 1) {
		showoptionExc(['auc_ext_price','auc_number']);
	}else if(v == 0 && t == 2) {
		showoptionExc(['auc_ext_price','auc_number']);
	}else if(v == 0 && t == 3) {
		showoptionExc(['auc_base_price','auc_delta_price','auc_number']);
	}
	setTimeout("showtypeoption()", 1000);
}
function showoptionExc(show) {
	var options = ['auc_ext_price','auc_base_price','auc_delta_price','auc_number'];

	for(var i=0;i<options.length;i++) {
			if(in_array(options[i], show)) {
				getid_auc(options[i]+'_t').style.display = 'block';
				getid_auc(options[i]+'_c').style.display = 'block';
			} else {
				getid_auc(options[i]+'_t').style.display = 'none';
				getid_auc(options[i]+'_c').style.display = 'none';
			}
	}
}
EXTRAFUNC['validator']['special'] = 'validateextra1';
function validateextra1() {
	if(shangjia_name.value == '') {
		showDialog('商家名称不能为空', 'alert', '', function () { shangjia_name.focus(); });
		return false;
	}
	if(shangjia_zhekou.value == '') {
		showDialog('折扣不能为空', 'alert', '', function () { shangjia_zhekou.focus() });
		return false;
	}
	if(shangjia_renjun.value == '') {
		showDialog('人均不能为空', 'alert', '', function () { shangjia_renjun.focus() });
		return false;
	}
	if(shangjia_time.value == '') {
		showDialog('营业时间不能为空', 'alert', '', function () { shangjia_time.focus() });
		return false;
	}
	if(shangjia_dizhi.value == '') {
		showDialog('商家地址不能为空', 'alert', '', function () { shangjia_dizhi.focus() });
		return false;
	}
	if(shangjia_dianhua.value == '') {
		showDialog('商家电话不能为空', 'alert', '', function () { shangjia_dianhua.focus() });
		return false;
	}

	return true;
}
function auctionaid_upload(aid, url) {
	getid_auc('auctionaid_url').value = url;
	updateauctionattach(aid, url, '{$_G['setting']['attachurl']}forum');
}
function updateauctionattach(aid, url, attachurl) {
	getid_auc('auctionaid').value = aid;
	getid_auc('auctionattach_image').innerHTML = '<img src="' + attachurl + '/' + url + '" class="spimg" />';
}
function textareasize(obj, op) {
	if(!op) {
		if(obj.scrollHeight > 70) {
			obj.style.height = (obj.scrollHeight < 300 ? obj.scrollHeight - heightag: 300) + 'px';
			if(obj.style.position == 'absolute') {
				obj.parentNode.style.height = (parseInt(obj.style.height) + 20) + 'px';
			}
		}
	} else {
		if(obj.style.position == 'absolute') {
			obj.style.position = '';
			obj.style.width = '290px';
			obj.parentNode.style.height = '';
		} else {
			obj.parentNode.style.height = obj.parentNode.offsetHeight + 'px';
			obj.style.width = BROWSER.ie > 6 || !BROWSER.ie ? '50%' : '600px';
			obj.style.position = 'absolute';
		}
	}
}
showtypeoption();
</script>
<!--{/block}-->
